<template>
	<view>
		<view class="body after-navber">
			<view class="info">
				<image class="bg" src="/static/images/CfBE2ZoSszeJiqt9.png"></image>
				<view class="flex-row">
					<view class="flex-grow-1" style="position: relative">
						<view class="info-1">
							<view class="flex-row">
								<view class="flex-grow-1 flex-x-center">账户余额(元)</view>
							</view>
						</view>
						<view class="info-2 flex-x-center">{{ user_info.money }}</view>
						<view class="info-3 flex-x-center">
							<!-- <navigator hoverClass="none" url="/pages2/shop/recharge/recharge">
								<view class="info-btn flex-x-center flex-y-center">充值</view>
							</navigator> -->
						</view>
					</view>
				</view>
			<!-- 	<view @tap="click" style="position: absolute; right: 0; top: 48rpx">
					<image class="info-img" src="/static/images/icon-balance-p.png"></image>
				</view> -->
			</view>
			<view :class="'modal-h flex-y-center flex-x-center ' + (show ? '' : 'hidden')">
				<view>
					<view class="w-100 body-h">
						<view class="flex-x-center">充值说明</view>
						<scroll-view :scrollY="true" style="color: #666; max-height: 250rpx; margin-top: 40rpx">
							<text>{{ setting.help }}</text>
						</scroll-view>
						<view @tap="close" class="flex-x-center">
							<view class="btn-h flex-x-center flex-y-center">我知道了</view>
						</view>
					</view>
				</view>
			</view>
			<view class="record">
				<!-- <view class="record-time flex-x-center flex-y-center">
					<view class="flex-row">
						<view @tap="dateDown" class="flex-grow-0">
							<image class="record-img" src="/static/images/icon-balance-left.png"
								style="margin: 0 84rpx"></image>
						</view>
						<picker @change="dateChange" class="flex-grow-1" fields="month" mode="date" :value="date_1">
							<view>{{ date }}</view>
						</picker>
						<view @tap="dateUp" class="flex-grow-0">
							<image class="record-img" src="/static/images/icon-balance-right.png"
								style="margin: 0 84rpx"></image>
						</view>
					</view>
				</view> -->
				<view class="record-list">
					<view class="record-one flex-row" :data-index="index"
						v-for="(item, index) in list" :key="item.id">
						<view class="flex-grow-1">
							<view style="width: 500rpx; text-align: left">
								<view class="record-1 text-more">{{ item.type_text }}</view>
								<view class="record-2">{{ item.createtime }}</view>
							</view>
						</view>

						<view :class="'flex-grow-0 flex-y-center ' + (item.money > 0 ? 'record-3' : 'record-4')">
							{{ item.money }}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {My} from '../../../apirequest/my-model.js';
	var m = new My();
	export default {
		data() {
			return {
				show: false,
				user_info: '',
				list: [],
				date_1: '',
				date: '',
			}
		},
		onShow() {
			this._index();
		},
		methods: {
			_index(){
				var that = this;
				m.get_user_info((res) => {
					if(res.code == 1){
						that.user_info = res.data
					}
				})
			},
			_getList(){
				
			},
			dateUp: function() {
				var that = this;

				
					var e = that.date_1;
					var a = (that.date, new Date(e));
					a.setMonth(a.getMonth() + 1);
					var o = a.getMonth() + 1;

					if ((o = o.toString())[1]) {
						o = o;
					} else {
						o = '0' + o;
					}
					this.date = a.getFullYear() + '年' + o + '月',
						this.date_1 = a.getFullYear() + '-' + o
				
			},
		dateChange: function (t) {
           
                var e = t.detail.value;
                var a = e.replace('-', '年') + '月';
				this.date=a
				this.date_1=e
     
        },
			dateDown: function() {
				var that = this;

		
					var e = that.date_1;
					var a = (that.date, new Date(e));
					a.setMonth(a.getMonth() - 1);
					var o = a.getMonth() + 1;

					if ((o = o.toString())[1]) {
						o = o;
					} else {
						o = '0' + o;
					}
					this.date = a.getFullYear() + '年' + o + '月'
					this.date_1 = a.getFullYear() + '-' + o
			
			},
			click: function () {
				
			    this.show=true
			},
			
			close: function () {
			    this.show=false
			},

		}
	}
</script>

<style>
	.info {
		position: relative;
		width: 750rpx;
		height: 324rpx;
		color: #fff;
		padding: 48rpx 0;
		margin-bottom: 20rpx;
		z-index: 10;
	}

	.bg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 324rpx;
		z-index: 0;
	}

	.info-img {
		width: 36rpx;
		height: 36rpx;
		margin-right: 20rpx;
	}

	.info-2 {
		margin: 30rpx 0;
		font-size: 30pt;
		line-height: 1;
	}

	.info-btn {
		width: 168rpx;
		height: 56rpx;
		font-size: 13pt;
		border-radius: 28rpx;
		border: 1rpx solid #fff;
	}

	.ad {
		width: 100%;
		height: 180rpx;
		margin-bottom: 20rpx;
	}

	.ad image {
		width: 100%;
		height: 100%;
	}

	.record {
		background-color: #fff;
		width: 100%;
	}

	.record-time {
		width: 100%;
		height: 80rpx;
		color: #353535;
	}

	.record-img {
		width: 12rpx;
		height: 20rpx;
	}

	.record-list {
		width: 100%;
		background-color: #fff;
	}

	.record-one {
		width: 100%;
		height: 140rpx;
		border-top: 1rpx solid #e2e2e2;
		padding: 0 24rpx;
	}

	.record-1 {
		color: #353535;
		margin-top: 30rpx;
		margin-bottom: 15rpx;
	}

	.record-2 {
		color: #666;
		font-size: 9pt;
	}

	.record-3 {
		font-size: 13pt;
		color: #ff4544;
	}

	.record-4 {
		font-size: 13pt;
		color: #3fc24c;
	}

	.modal-h {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		z-index: 1000;
	}

	.body-h {
		padding: 50rpx;
		background-color: #fff;
		width: 600rpx;
		border-radius: 10rpx;
	}

	.btn-h {
		margin-top: 64rpx;
		width: 100%;
		height: 80rpx;
		background-color: #ff4544;
		border-radius: 10rpx;
		color: #fff;
	}

	.hidden {
		display: none;
	}
</style>
